package pixeleditor.gui;

import java.awt.Dimension;
import java.util.ResourceBundle;

import javax.swing.Action;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

import common.i18n.ChangeLanguage;
import common.i18n.IChangeLanguage;

import pixeleditor.ctrl.ControlFactory;

@SuppressWarnings("serial")
public class ChooseDestructiblePanel extends JPanel implements IChangeLanguage {

	private JCheckBox inDestructible = new JCheckBox();
	
	public ChooseDestructiblePanel() {
		ChangeLanguage.addObserver(this);
		initComponents();
		initControls();
	}
	
	private void initComponents() {
		setPreferredSize(new Dimension(70,70));
		setLanguage(ChangeLanguage.currentLanguage);

		add(inDestructible);
	}
	
	private void initControls() {
		Action a = (Action) ControlFactory.getControl(ControlFactory.CHOOSE_DESTRUCTIBLE_CTRL);
		inDestructible.setAction(a);
		a.putValue("ChooseDestructible.inDestructible", inDestructible);
	}

	@Override
	public void setLanguage(ResourceBundle rb) {
		setBorder(new TitledBorder(rb.getString("editorDestructible")));	
	}
}
